<?php
    class UserModule extends CWebModule
    {
        public function init()
        {
            // set params for module
            Yii::app()->params->mergeWith(require(dirname(__FILE__).'/config/params.php'));

            // import the module-level models and components
            $this->setImport(array(
                'user.components.*',
                'user.models.*',
                'application.models.geo.City',
                'application.models.geo.District',
                'hangve.models.PostCat',
            ));

            Yii::app()->setComponents(array(
                'user' => array(
                    'class' => 'user.components.WebUser',
                    'allowAutoLogin'=>true,
                    'loginUrl'=>array('/user/page/login'),
                ),
                'db'=>Yii::app()->dbUser, 
                'errorHandler'=>array(
                    'errorAction'=>'/user/page/error',
                ),
            ));


            Yii::app()->theme = 'hangve';
        }

        public function beforeControllerAction($controller, $action)
        {
            if(parent::beforeControllerAction($controller, $action))
            {
                // this method is called before any module controller action is performed
                // you may place customized code here
                return true;
            }
            else
                return false;
        }
    }
